package mc0101.mccache.thread;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.TaskRejectedException;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
@Slf4j
@Component("ZcCacheThreadPoolTaskExecutorProxy")
public class ZcThreadPoolTaskExecutor {


    @Autowired
    @Qualifier("zcCacheThreadPoolTaskExecutor")
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    public void execute(Runnable runnable){
        try {
            threadPoolTaskExecutor.execute(runnable);
        } catch (TaskRejectedException ex){
            log.warn("当前已经有刷新线程在执行了，就不需要再执行一次了");
        }
    }
}